package com.producer.demo.component;

import com.producer.demo.config.RabbitmqConfig;
import com.producer.demo.constant.MQConstant;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import com.rabbitmq.client.Channel;

import java.util.Date;

@Component
public class ReceiveHandler {

		//监听email队列
	   @RabbitListener(queues = {RabbitmqConfig.QUEUE_INFORM_EMAIL})
	   public void receive_email(String msg,Message message,Channel channel){
	       System.out.println(msg);
	   }
	//监听sms队列
	   @RabbitListener(queues = {RabbitmqConfig.QUEUE_INFORM_SMS})
	   public void receive_sms(String msg,Message message,Channel channel){
	       System.out.println(msg);
	   }


	//监听hello队列
/*	@RabbitListener(queues = {MQConstant.HELLO_QUEUE_NAME})
	public void hello(String msg,Message message,Channel channel){
		System.out.println(System.currentTimeMillis()+":"+msg);
	}*/
	
}
